# aem.two_d.transient.unit_step_evaporation -- 
#
# Copyright (c) 2000, V.Kelson and M.Bakker
#           (c) 2001, Willem Jan Zaadnoordijk

from types import *
from cmath import exp,pi
from misc.funE_B import E1

import geometry
XY = geometry.XY

import base

import aem.container
RowList = aem.container.RowList
ColumnList = aem.container.ColumnList
 
class UnitStepEvaporation(base.Element):
	'''Class for transient evaporation step to be used as child of transient evaporation

	Python call: UnitStepEvaporation(t,parent=None)

	Attributes:

	  - time:  start time
	  - parent: parent of the element (inherited from Element)
	  - parameters: dummy ColumnList [1] so that the contribution functions
	                                     do not need to be overloaded

	Overloaded functions from Element: __init__, 
	                                   potentialInfluence, dischargeInfluence
	'''

	def __init__(self,t,parent=None):
		'''Constructor'''
		self.t = t
		base.Element.__init__(self,parent)
		self.parameters=ColumnList([1])

	def __repr__(self):
		# Parent not yet included
		return 'UnitStepEvaporation(t=' + str(self.t) + ')'

	def potentialInfluence(self,xy,t):
		if t > self.t :
			return RowList( [ (-self.parent.alpha*(t-self.t)) ] )
		else:
			return RowList( [ 0 ] )

	def dischargeInfluence(self,xy,t):
		return RowList( [ XY(0.0,0.0) ] )

	def rechargeInfluence(self,xy,t):
		if t > self.t :
			return RowList( [ 1 ] )
		else:
			return RowList( [ 0 ] )

	def extractionInfluence(self,xy,t):
		print "extractionInfluence of unitStepEvaporation is infinite\n"
		return RowList( [ 0 ] )
